<?php

namespace App\Service\AppStore;

use App\Helpers\AliyunUtil;
use App\Model\AppStore\Article;
use App\Service\BaseService;

/**
 * 文章详情
 */
class ArticleDetailService extends BaseService
{
    public function handle()
    {
        $userId = $this->getUserId();
        $articleId = $this->request->input('article_id', 0);
        $item = Article::getItem($articleId);
        if (!$item) return [];
        $ret = [
            'article_id' => $item['id'],
            'title' => $item['title'],
            'thumb' => AliyunUtil::imageResize(AliyunUtil::IMG_HOST_V2 . $item['thumb'], 400, 250),
            'content' => $item['content'],
        ];
        return $ret;
    }
}
